<template>
	<view class="capital">
		
		<scroll-view scroll-y="true" class="main" @scrolltolower="lower()">

			<view class="list" v-for="(item,index) of list" :key="index">
				<image :src="oss(item.user.avatar)" class="avatar" mode=""></image>
				<view class="l">
					<view class="t">{{item.user.nickname}}</view>
					<view class="b">{{item.createtime | date}}</view>
				</view>
				<view class="r">+{{item.num}}</view>
			</view>

		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				finish: false,
				type: '',
				list: [],
				user: ''
			};
		},
		onLoad() {
			this.getList()
		},
		methods: {
			lower() {
				this.page++
				this.getList()
			},
			getList() {
				if (this.finish) {
					return
				}
				uni.$u.http.post('/rebate', {
					page: this.page
				}).then(res => {
					if (res.code == 1) {
						this.list = this.list.concat(res.data)
						if (res.data.list.length === 0) {
							this.finish = true
						}
					}
				}).catch((res) => {

				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.capital {
		height: 100vh;
		position: relative;
		box-sizing: border-box;
		padding-top: 20rpx;
		background: #F6F6F6;

		.main {
			position: absolute;
			left: 0;
			bottom: 0;
			top: 0;
			width: 100%;

			.list {
				display: flex;
				align-items: center;
				padding: 20rpx;
				margin: 0 26rpx 20rpx;
				border-radius: 20rpx;
				background-color: #fff;
				.avatar{
					width: 120rpx;
					height: 120rpx;
					border-radius: 50%;
					margin-right: 20rpx;
					flex-shrink: 0;
				}
				.l {
					flex: 1;

					.t {
						font-size: 32rpx;
						color: #191615;
						font-weight: bold;
						margin-bottom: 10rpx;
					}

					.b {
						color: #999999;
						font-size: 30rpx;
					}
				}

				.r {
					flex-shrink: 0;
					font-size: 40rpx;
					color: #FF5B1A;
					margin-left: 20rpx;
				}
			}
		}

		.header {
			width: 697rpx;
			height: 287rpx;
			margin: 0 auto;
			position: relative;
			display: flex;
			align-items: center;
			justify-content: center;
			flex-shrink: 0;

			.bg {
				width: 697rpx;
				height: 287rpx;
			}

			.info {
				width: 697rpx;
				height: 287rpx;
				position: absolute;
				left: 0;
				top: 0;
				box-sizing: border-box;
				padding: 60rpx 40rpx 0;

				.title {
					font-weight: bold;
					color: #191615;
					font-size: 38rpx;
					margin-bottom: 20rpx;
				}

				.num {
					display: flex;
					align-items: center;
					justify-content: space-between;

					.l {
						display: flex;
						align-items: center;
						color: #191615;
						font-size: 56rpx;

						.icon {
							color: #191615;
							font-size: 32rpx;
						}
					}

					.r {
						display: flex;
						align-items: center;

						.recharge {
							width: 140rpx;
							height: 66rpx;
							background-color: #FFEB88;
							display: flex;
							align-items: center;
							justify-content: center;
							color: #575859;
							margin-right: 40rpx;
							border-radius: 33rpx;
						}

						.withdraw {
							width: 140rpx;
							height: 66rpx;
							display: flex;
							align-items: center;
							justify-content: center;
							box-sizing: border-box;
							border: 1px solid #575859;
							color: #575859;
							border-radius: 33rpx;
						}
					}
				}
			}
		}
	}
</style>
